/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package unc.pds.facets;

import unc.pds.filemodel.AlbumRemote;
import unc.pds.filemodel.PhotoRemote;
import unc.pds.model.Model;
import unc.pds.model.UserRemote;

/**
 *
 * @author Mikhail
 */
public class AlbumFacet implements Facet {
    private AlbumRemote album;
    private boolean isOwn;
    public AlbumFacet(AlbumRemote album, boolean isOwn) {
        this.album = album;
        this.isOwn = isOwn;
    }
    public String draw() throws Exception {
        String result = "";
        PhotoRemote[] photos = album.getPhotos();
        result += "<h4>"+album.getName()+" - "+album.getAuthor().getNickname()+"</h4>";
        Model parent = album.getParent();
        result += "<p><a href=\"index.jsp?id="+parent.getKey()+"&view=albums\"><img src=\"img/back.png\" alt=\"Назад\"/></a></p>\n";
        for (int i = 0; i < photos.length; i++) {
            result += "<a href=\"index.jsp?id="+photos[i].getKey()+"\">";
            result += "<img id=\"photo\" src=\"photo.jsp?id="+photos[i].getKey()+"&view=mini\"/></a>\n";
        }
        return result;
    }
    public boolean isSide() {
        return false;
    }
}
